<template>
  <div>
    <template v-for="(menu) in menuData">
      <el-submenu :key="menu.powerCode" :index="menu.href" v-if="menu.child"
        @click="generatorPath(menu.href,menu)">
        <template slot="title">
          <i :class="menu.icon" class="iconfont"></i>
          <span slot="title">{{menu.title}}</span>
        </template>
        <MenuTree :menuData="menu.child"></MenuTree>
      </el-submenu>
      <el-menu-item :key="menu.powerCode" :index="menu.href" v-else
        @click="generatorPath(menu.href,menu)">
        <i :class="menu.icon" class="iconfont"></i>
        <span slot="title">{{menu.title}}</span>
      </el-menu-item>
    </template>
  </div>
</template>
 
<script>
export default {
  name: "MenuTree",
  props: ['menuData'],
  components: {

  },
  methods: {
    generatorPath(href, menu) {
      localStorage.setItem("path", href);
      this.$store.commit("Tage", href);
      this.$store.commit("getvisited", menu);
    }
  }
}
</script>
 
<style lang="less" scoped>
.bgc {
  background-color: #f56c6c;
}

.bgcChild {
  background-color: #f56c6c;
}
</style>